package kr.co.mustgo.domain.review;

import java.io.Serializable;
import java.util.List;

import org.springframework.web.multipart.MultipartFile;

public class ReviewsBoard implements Serializable{

	private int no;				//글번호
	private String title;		//글 제목
	private String writer;		//작성자
	private String content;		//내용
	private String writeDate;	//작성일시
	private int viewcount;		//조회수
	private List<Comment> comment;		//원본글에 대한 댓글들
	private List<MultipartFile> upfile;	//이미지파일에 대한 정보
	private String filename;			//이미지파일명
	
	//생성자
	public ReviewsBoard(){}
	public ReviewsBoard(String title, String writer, String content) {
		super();
		this.title = title;
		this.writer = writer;
		this.content = content;
	}
	public ReviewsBoard(String title, String writer, String content,
			List<MultipartFile> upfile) {
		super();
		this.title = title;
		this.writer = writer;
		this.content = content;
		this.upfile = upfile;
	}
	public ReviewsBoard(String title, String writer, String content,
			String filename) {
		super();
		this.title = title;
		this.writer = writer;
		this.content = content;
		this.filename = filename;
	}
	public ReviewsBoard(int no, String title, String writer, String content,
			String writeDate, int viewcount, List<Comment> comment,
			List<MultipartFile> upfile, String filename) {
		super();
		this.no = no;
		this.title = title;
		this.writer = writer;
		this.content = content;
		this.writeDate = writeDate;
		this.viewcount = viewcount;
		this.comment = comment;
		this.upfile = upfile;
		this.filename = filename;
	}
	
	//getter/setter
	public int getNo() {
		return no;
	}
	public void setNo(int no) {
		this.no = no;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getWriter() {
		return writer;
	}
	public void setWriter(String writer) {
		this.writer = writer;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getWriteDate() {
		return writeDate;
	}
	public void setWriteDate(String writeDate) {
		this.writeDate = writeDate;
	}
	public int getViewcount() {
		return viewcount;
	}
	public void setViewcount(int viewcount) {
		this.viewcount = viewcount;
	}
	public List<Comment> getComment() {
		return comment;
	}
	public void setComment(List<Comment> comment) {
		this.comment = comment;
	}
	public List<MultipartFile> getUpfile() {
		return upfile;
	}
	public void setUpfile(List<MultipartFile> upfile) {
		this.upfile = upfile;
	}
	public String getFilename() {
		return filename;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	
	//toString()
	@Override
	public String toString() {
		return "ReviewsBoard [no=" + no + ", title=" + title + ", writer="
				+ writer + ", content=" + content + ", writeDate=" + writeDate
				+ ", viewcount=" + viewcount + ", comment=" + comment
				+ ", upfile=" + upfile + ", filename=" + filename + "]";
	}
	
	//hashCode()/equeals()
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((comment == null) ? 0 : comment.hashCode());
		result = prime * result + ((content == null) ? 0 : content.hashCode());
		result = prime * result
				+ ((filename == null) ? 0 : filename.hashCode());
		result = prime * result + no;
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result + ((upfile == null) ? 0 : upfile.hashCode());
		result = prime * result + viewcount;
		result = prime * result
				+ ((writeDate == null) ? 0 : writeDate.hashCode());
		result = prime * result + ((writer == null) ? 0 : writer.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ReviewsBoard other = (ReviewsBoard) obj;
		if (comment == null) {
			if (other.comment != null)
				return false;
		} else if (!comment.equals(other.comment))
			return false;
		if (content == null) {
			if (other.content != null)
				return false;
		} else if (!content.equals(other.content))
			return false;
		if (filename == null) {
			if (other.filename != null)
				return false;
		} else if (!filename.equals(other.filename))
			return false;
		if (no != other.no)
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (upfile == null) {
			if (other.upfile != null)
				return false;
		} else if (!upfile.equals(other.upfile))
			return false;
		if (viewcount != other.viewcount)
			return false;
		if (writeDate == null) {
			if (other.writeDate != null)
				return false;
		} else if (!writeDate.equals(other.writeDate))
			return false;
		if (writer == null) {
			if (other.writer != null)
				return false;
		} else if (!writer.equals(other.writer))
			return false;
		return true;
	}

	
}



















